<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.sunsoninfo.entity.MtMember"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%
	boolean memberFlag = (Boolean)request.getAttribute("memberFlag");
	MtMember member = (MtMember)request.getAttribute("member");
%>

<!DOCTYPE html>
<html>
    <head>
        <title>活动报名</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=480" />
        <link rel="stylesheet" href="templets/m2013/css/reset.css" />
        <link rel="stylesheet" href="templets/m2013/css/mainCssRed.css" />
        <script type="text/javascript" src="templets/m2013/js/klass.min.js"></script>
        <script type="text/javascript" src="templets/m2013/js/jquery.min.js"></script>
        <script type="text/javascript" src="templets/m2013/js/flexslider.js"></script>
        <script type="text/javascript" src="templets/m2013/js/MainJS.js"></script>
        
        <style type="">
        	input:focus {
	    		border: 1px #37A6CD solid;
	    		box-shadow:1px 1px 10px #37A6CD,-1px -1px 10px #37A6CD;
	    	}
	    	textarea:focus{
	    		border: 1px #37A6CD solid;
	    		box-shadow:1px 1px 10px #37A6CD,-1px -1px 10px #37A6CD;
	    	}
        </style>
        <!--        Hides URL bar on iPhone-->
        <script type="application/x-javascript">
            if (navigator.userAgent.indexOf('iPhone') != -1) {
            addEventListener("load", function() {
            setTimeout(hideURLbar, 0);
            }, false);
            }

            function hideURLbar() {
            window.scrollTo(0, 1);
            }

			function checkForm(){
				var hd_name = document.getElementById("hd_name").value;
				if(hd_name == ""){
					$('.fc_f00').show();return false;
				}
				$('.fc_f00').hide();
				var hd_tel = document.getElementById("hd_tel").value;
				if(hd_tel == ""){
					$('.fc_f01').show();return false;
				}
				$('.fc_f01').hide();
				var hd_xq = document.getElementById("hd_xq").value;
				if(hd_xq == ""){
					$('.fc_f02').show();return false;
				}
				$('.fc_f02').hide();
				$.post('registerActivity.do?fromUserName='+$('#fromUserName').val()+'&userid='+$('#userid').val(),function(data){
					if(data.length==0){
						$('.fc_f00').text('未知原因，报名失败，请重试！');
					}else{
						$('#activityDiv').hide();
						$('#activitySccuessDiv').show();
					}
				},'json')
			}
        </script>

    </head>
    <body>
        <!--        main Content-->
        <div id="BlogSContentWrapper">
			<span class="BigComments"></span>
            <h2>活动报名登记</h2>
            <p class="BlogInfo">请您填写真实资料，通过手机报名享受活动优惠。</p>
            <%
            	if(false == memberFlag){
            %> 
            	<ul>
            		<li><p>&nbsp;</p></li>
                    <li><p>注册会员后才可报名，请<a href="#">注册会员</a>。</p></li>
            	</ul>
           	<%		
            	}else{
            %> 
            <div id="activityDiv">
            <form name="myForm" action="registerActivity.do" enctype="multipart/form-data" method="get">
            <input type="hidden" name="userid" id="userid" value="<%=member.getUserid() %>" />
            <input type="hidden" name="fromUserName" id="fromUserName value="<%=member.getWeixinid() %>" />
                <ul>
                    <li><p>姓名:</p><input type="text" name="hd_name" id='hd_name' /><img class="fc_f00" src="/MyWeixin/img/error_icon.png" style="display: none;" /></li>
                    <li><p>手机:</p><input type="text" name="hd_tel" id='hd_tel' /><img class="fc_f01" src="/MyWeixin/img/error_icon.png" style="display: none;" /></li>
                    <li><p>需求:</p><textarea name='hd_xq' id='hd_xq' cols="30" rows="10" style="width: 92%"></textarea><img class="fc_f02" src="/MyWeixin/img/error_icon.png" style="display: none;" /></li>
                    <li style="display:none;"><p>报名时间:</p><input type="hidden" name="hd_time" id='hd_time' value="" /></li>
                    <li><input class="readMore" type="button" value="提交" name="submit" onclick="checkForm()"/></li>
                </ul>
            </form>
            </div>
            <%		
            	}
            %>
            
            <div id="activitySccuessDiv" style="display: none;">
            	<ul>
            		<li><p>&nbsp;</p></li>
                    <li><p>您已报名成功！</p></li>
            	</ul>
            </div>
		</div>
    </body>
</html>